<style type="text/css">
	.smtp{ display:none; }
	.php-mail-function{ display:none; }
</style>
<?php $this->renderPartial('/admin/menu/settings');?>
<?php
foreach(Yii::app()->user->getFlashes() as $key => $message){
	echo '<div class="'.$key.'"><p>'.$message."</p></div>\n";
}
?>

<form role="form" class="form-horizontal" method="post" autocomplete="off">
	<div class="form-group">
        <label class="col-sm-2">Method</label>
        <div class="col-sm-3">
        	<label><input type="radio" name="settings[mailer]"  value="php-mail-function" <?php if($arrMailSettings['mailer'] == 'php-mail-function'): ?>checked<?php endif; ?> onClick="showHide(this.value);" required=""> PHP Mail Function</label>
            <br>
   			<label><input type="radio" name="settings[mailer]" value="smtp" <?php if($arrMailSettings['mailer'] == 'smtp'): ?>checked<?php endif; ?> onClick="showHide(this.value);"> SMTP Server</label>
        </div>
    </div>
    
     <div class="form-group php-mail-function">
        <label for="sendmail_path" class="col-sm-2">Sendmail path</label>
        <div class="col-sm-3">
        <input type="text" placeholder="sendmailpath" name="settings[sendmail_path]" id="sendmail_path" class="form-control" value="<?php echo $arrMailSettings['sendmail_path'] ?>">
        </div>
    </div>
    
    <div class="form-group smtp">
        <label for="smtp_host" class="col-sm-2">Server</label>
        <div class="col-sm-3">
        <input type="text" placeholder="Server" name="settings[smtp_host]" id="smtp_host" class="form-control" value="<?php echo $arrMailSettings['smtp_host'] ?>">
        </div>
    </div>
    
    <div class="form-group smtp">
        <label for="smtp_port" class="col-sm-2">Port</label>
        <div class="col-sm-3">
        <input type="text" placeholder="Port" name="settings[smtp_port]" id="smtp_port" class="form-control" value="<?php echo $arrMailSettings['smtp_port'] ?>">
        </div>
    </div>
    
     <div class="form-group smtp">
        <label for="smtp_port" class="col-sm-2">Authenticate</label>
        <div class="col-sm-3">
        	<label><input type="radio" name="settings[smtp_authentication]"  value="1" <?php if($arrMailSettings['smtp_authentication'] == '1'): ?>checked<?php endif; ?>> True</label>
   			<label><input type="radio" name="settings[smtp_authentication]" value="0" <?php if($arrMailSettings['smtp_authentication'] == '0'): ?>checked<?php endif; ?>> False</label>
        </div>
    </div>
    
    <div class="form-group smtp">
        <label for="smtp_user" class="col-sm-2">User</label>
        <div class="col-sm-3">
        <input type="text" placeholder="User" name="settings[smtp_user]" id="smtp_user" class="form-control" value="<?php echo $arrMailSettings['smtp_user'] ?>" autocomplete="off" maxlength="128">
        </div>
     </div>
     
     <div class="form-group smtp">
        <label for="smtp_password" class="col-sm-2">Password</label>
        <div class="col-sm-3">
        <input type="password" placeholder="Password" name="settings[smtp_password]" id="smtp_password" class="form-control" value="<?php echo $arrMailSettings['smtp_password'] ?>" maxlength="128">
        </div>
     </div>
    
     <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button class="btn btn-primary" type="submit">Save</button>
        </div>
      </div>
</form>
<script type="application/javascript">
	$(document).ready(function(){
		var method = $('input[name=\'settings[mailer]\']:checked').val();
		showHide(method);
	});
	function showHide(method){
		if(method == 'php-mail-function') {
			$('.smtp').hide();
			$('.php-mail-function').show('slow');
		}
		else {
			$('.php-mail-function').hide();
			$('.smtp').show('slow');
		}	
	}
</script>